package com.net.showcase.builder;

import com.net.j8583.Define8583Bank;
import com.net.j8583.Protocol8583BocPay;
import com.net.utils.Socket;

import java.util.HashMap;

/**
 * Date: 14-1-24
 * Time: 17:49
 */
public class CommunicateTester {
    public static void main(String[] args) throws Exception {
        HashMap hashMap = new HashMap();
        hashMap.put("cardNo", "4096665528659482");
        Protocol8583BocPay protocol = new Protocol8583BocPay(hashMap, new Define8583Bank());
        byte[] result = protocol.makeRequestContent();
        Socket socket = new Socket(protocol.getCommunicateConfigInfo());
        byte[] response = socket.doReuquest(result, protocol);
        protocol.makeResponseObject(response);

        String cardNo = protocol.getFieldInfo(2).getRespDecodeValue();
        System.out.println("cardNo = " + cardNo);
    }
}
